/*
 * @Description: token 及userid设置
 * @Author: wangwangwang
 * @Date: 2020-09-04 15:42:38
 * @LastEditors: wangwangwang
 * @LastEditTime: 2020-12-01 11:33:39
 */

const TokenKey = 'access-token';
const IdKey = 'userId';
const InfoKey = 'userInfo';
const TabKey = 'currentTab';
const PerMission = 'permission';
const ButtonList = 'buttonlist';

export function getButtonList() {
  return JSON.parse(window.sessionStorage.getItem(ButtonList))
}

export function setButtonList(data) {
  return window.sessionStorage.setItem(ButtonList, JSON.stringify(data))
}

export function removeButtonList() {
  return window.sessionStorage.removeItem(ButtonList)
}

export function getPerMission() {
  return JSON.parse(window.localStorage.getItem(PerMission))
}

export function setPerMission(data) {
  return window.localStorage.setItem(PerMission, JSON.stringify(data))
}

export function removePerMission() {
  return window.localStorage.removeItem(PerMission)
}
export function getToken() {
  return window.localStorage.getItem(TokenKey)
}

export function setToken(token) {
  return window.localStorage.setItem(TokenKey, token)
}

export function removeToken() {
  return window.localStorage.removeItem(TokenKey)
}
export function getUserId() {
  return window.localStorage.getItem(IdKey)
}

export function setUserId(id) {
  return window.localStorage.setItem(IdKey, id)
}

export function removeUserId() {
  return window.localStorage.removeItem(IdKey)
}

export function getUserInfo() {
  return JSON.parse(window.localStorage.getItem(InfoKey))
}

export function setUserInfo(data) {
  return window.localStorage.setItem(InfoKey, JSON.stringify(data))
}

export function removeUserInfo() {
  return window.localStorage.removeItem(InfoKey)
}

export function setCurrentTab(data) {
  return window.localStorage.setItem(TabKey, data)
}
